// 商品分类
let oshop = document.querySelector(".shop-class");
let omenue = document.querySelector(".menue")
let omitem = document.getElementsByClassName("menue-item");
let ocont1 = document.querySelector(".part-c1");
let obrand = document.querySelector(".brand-box");
let opop = document.querySelector(".pop")
let oinner = document.getElementsByClassName("cont-box")
oshop.onmouseover = function () {
    omenue.style.display = "block";
    for (var i = 0; i < omitem.length; i++) {
        //创建新的属性
        omitem[i].index = i;
        omitem[i].onmouseover = function () {
            opop.style.display = "block";
            for (var j = 0; j < omitem.length; j++) {
                //this只对应当前时间的dom元素
                if (this.index == j) {
                    oinner[j].style.display = "block"
                    obrand.style.backgroundImage = `url(./imgs/mainnav-menu/${j}.png)`
                } else {
                    oinner[j].style.display = "none"
                }
            }
        }
    }
    omenue.parentElement.onmouseleave = function () {
        omenue.style.display = "none"
        opop.style.display = "none";
    }
}




